Skip to content

Conversation

@0xDAEF0F
Copy link
Contributor

Summary

  • Horizontal scrolling is now only enabled when lines in the current viewport actually overflow
  • Previously, users could scroll horizontally even when viewing short lines, as long as the file contained long lines elsewhere
  • When vertical scrolling brings shorter lines into view, the horizontal scroll smoothly animates back

Changes

  • Add DOM-based text measurement utilities (measureTextWidth, getMaxVisibleLineWidth) for accurate line width calculation
  • Modify wheel handler to calculate actual visible lines (without tokenization buffer) and only allow horizontal scroll when they overflow
  • Add animateScrollLeft utility with 150ms ease-out cubic animation for smooth transitions
  • Automatically clamp/reset horizontal scroll position when viewport changes

Test plan

  • Open a file with some long lines and some short lines
  • Scroll to short lines - horizontal scroll should be disabled
  • Scroll to long lines that extend past the viewport - horizontal scroll should work
  • While scrolled horizontally, scroll vertically to shorter lines - should see smooth animation back to 0

Previously, horizontal scrolling was enabled for the entire buffer,
allowing users to scroll even when visible lines did not overflow.
This was distracting when viewing short lines that happened to be
in a file with long lines elsewhere.

Changes:
- Add DOM-based text measurement utilities for accurate line width calculation
- Modify wheel handler to only allow horizontal scroll when visible lines overflow
- Add smooth animation (150ms ease-out) when horizontal scroll clamps or resets
- Automatically adjust scroll position when vertical scrolling brings shorter lines into view
@mehmetozguldev mehmetozguldev self-requested a review December 21, 2025 21:13
@mehmetozguldev mehmetozguldev added the area: editor Specific to editor label Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Specific to editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants